package com.bstu.ciit.lab3;
import java.util.Random;


public class Main {
	public static void main(String args[])
	{
		Random random= new Random();
		Dog dog=new Dog(200,100);
		Field field=new Field(50,70);
		field.wallGener();
		field.lakeGener();
		field.setFood(random.nextInt(50),random.nextInt(70));
//		field.setFood(25,78);
		dog.fitnesCalculate(field);
//		dog.fitnesPrint();
		int iter=0;
		do
		{
			dog.sort();
			dog.newGeneration();
			dog.fitnesCalculate(field);
			dog.sort();
		//	System.out.print(iter++ +"    ");
		//	dog.fitnesPrint();
			
		}
		while (!dog.stopMarker() && !dog.badPopulation());
		if (!dog.badPopulation())
		{
			field.printField(dog.returnSmartDog());
			System.out.println("@ - dog's home;");
			System.out.println("8 - food;");
			System.out.println("* - dog's way;");
			System.out.println("~ - water;");
			System.out.println("| - wall.");
			System.out.print("Whis result was gets in "+iter+" iteration.");
		}
		else
			System.out.println("All dog was dead.");
	
	}
}
